import request from '../utils/request'

// 修改收货地址
const setLinkman = (params = {}) => request.post('/user/shipping-address/update', params)
// 删除收货地址
const deleteLinkman = (params = {}) => request.post('/user/shipping-address/delete', params)
// 收货地址详情
const linkmanDetails = (params = {}) => request.get('/user/shipping-address/detail/v2', { params })
// 收货人列表
const linkmanList = (params = {}) => request.post('/user/shipping-address/list/v2', params)
// 新增收货人地址
const addLinkman = (params = {}) => request.post('/user/shipping-address/add', params)
// 修改购物车数量
const setCartNumber = (params = {}) => request.post('/shopping-cart/modifyNumber', params)
// 删除购物车数据
const deleteCartItem = (params = {}) => request.post('/shopping-cart/remove', params)
// 修改购物车选中状态
const setCartItem = (params = {}) => request.post('/shopping-cart/select', params)
// 购物车数据
const getCart = (params = {}) => request.get('/shopping-cart/info', { params })
// 加入购物车
const addCart = (params = {}) => request.post('/shopping-cart/add', params)
// 用户注册
const userRegister = (params = {}) => request.post('/user/username/register', params)
// 用户登录
const userLogin = (params = {}) => request.post('/user/username/login', params)
// 商品详情
const getDetails = (id) => request.get('/shop/goods/detail', {
  params: {
    id
  }
})
// 推荐商品
const goodsItem = (params = {}) => request.post('/shop/goods/list/v2', params)
// 获取分类
const getCate = (params = {}) => request.get('/shop/goods/category/all', { params })
// 获取首页轮播
const getBanner = (params = {}) => request.get('/banner/list', { params })

export {
  getBanner,
  getCate,
  goodsItem,
  getDetails,
  userRegister,
  userLogin,
  addCart,
  getCart,
  setCartItem,
  deleteCartItem,
  setCartNumber,
  addLinkman,
  linkmanList,
  linkmanDetails,
  setLinkman,
  deleteLinkman
}
